package com.ruoyi.report_ljlm.mapper;

import com.ruoyi.report_ljlm.domain.YsdgsfjlbBsInfo;
import com.ruoyi.report_ljlm.domain.vo.YsdgsfjlbBsInfoVo;
import com.ruoyi.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 路基路面压实度试验检测记录(灌砂法)Mapper接口
 *
 * @author llb
 * @date 2024-08-27
 */
public interface YsdgsfjlbBsInfoMapper extends BaseMapperPlus<YsdgsfjlbBsInfoMapper, YsdgsfjlbBsInfo, YsdgsfjlbBsInfoVo> {

    @Select("SELECT DISTINCT\n" +
        "\tinfo.gongcbwyt \n" +
        "FROM\n" +
        "\tsyrw_bs_data_report report\n" +
        "\tLEFT JOIN syrw_ref_report_excel ref ON report.report_id = ref.report_id\n" +
        "\tLEFT JOIN report_ljlm_ysdgsfjlb_bs_info info ON ref.excel_id = info.excel_id \n" +
        "WHERE\n" +
        "\treport.dept_id = #{deptId} \n" +
        "\tAND ref.excel_type_id = 1829048815838072834 \n" +
        "\tAND info.gongcbwyt IS NOT NULL AND info.zhuangh IS NOT NULL \n" +
        "\tAND report.sy_type = #{syTypeId} \n" +
        "\tAND report.del_flag = 0 \n" +
        "\tAND ref.del_flag = 0 \n" +
        "\tAND info.del_flag = 0 \n" +
        "ORDER BY\n" +
        "\tinfo.gongcbwyt")
    List<String> selectGcbwList(@Param("deptId") Long deptId, @Param("syTypeId") Long syTypeId);


    @Select("SELECT \n" +
        "\tinfo.*\n" +
        "FROM\n" +
        "\tsyrw_bs_data_report report\n" +
        "\tLEFT JOIN syrw_ref_report_excel ref ON report.report_id = ref.report_id\n" +
        "\tLEFT JOIN report_ljlm_ysdgsfjlb_bs_info info ON ref.excel_id = info.excel_id \n" +
        "WHERE\n" +
        "\treport.dept_id = #{deptId} \n" +
        "\tAND ref.excel_type_id = 1829048815838072834 \n" +
        "\tAND info.gongcbwyt = #{gongcbwyt} AND info.zhuangh IS NOT NULL \n" +
        "\tAND report.sy_type = 131 \n" +
        "\tAND report.del_flag = 0 \n" +
        "\tAND ref.del_flag = 0 \n" +
        "\tAND info.del_flag = 0 ")
    List<YsdgsfjlbBsInfoVo> tstjList(@Param("deptId") Long deptId, @Param("gongcbwyt") String gongcbwyt);
}
